﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using IGolovkine.ShoutCastRipper;

namespace IGolovkine.ShoutCastRipper.Service
{
    public class CompositeLogWriter : ILogWriter
    {
        private List<ILogWriter> _logWriters;
        public CompositeLogWriter()
        {
            _logWriters = new List<ILogWriter>();
        }
        
        public IList<ILogWriter> LogWriters
        {
            get { return _logWriters; }
        }
        
        public void WriteLine(string format, params object[] args)
        {
            _logWriters.ForEach(w => w.WriteLine(format, args));
        }

        public void WriteLine()
        {
            _logWriters.ForEach(w => w.WriteLine());
        }

        public void WriteLine(string message)
        {
            _logWriters.ForEach(w => w.WriteLine(message));
        }

        public void WriteException(string message, Exception ex)
        {
            _logWriters.ForEach(w => w.WriteException(message, ex));
        }
    }
}
